package 力扣算法练习.main1.newPart1;

public class day2 {
    //https://www.nowcoder.com/practice/02d8d42b197646a5bbd0a98785bb3a34?tpId=122&tqId=33679&ru=/exam/oj
    public void find3(String input){

        int[] abc=new int[4];//存读出来的数
        int index=0;//存数据的数组的索引
        boolean falg=false;//控制是不是负数
        char[] chars = input.toCharArray();
        int slow=0,fast=0;
        int n=1,temp=0;
        //将数字读取出来
        while(fast<chars.length){
            while (fast< chars.length&&chars[fast]!=' '){
                fast++;
                if (fast==chars.length)break;

            }
            for (int j = fast-1; j >=slow; j--) {
                if (chars[j]=='-'){
                    falg=true;
                }else{
                    if (chars[j]=='0'){
                        temp*=10;
                        n*=10;
                    }else{
                        temp+=(chars[j]-48)*n;
                        n*=10;
                    }
                }
            }
            if (falg){
                abc[index++]=-temp;
                falg=false;
            }else{
                abc[index++]=temp;
            }
            n=1;
            temp=0;
            fast++;
            slow=fast;
        }
        //进行运算
        int a=(abc[0]+abc[2])>>1;
        int b=(abc[1]+abc[3])>>1;
        int c=abc[3]-b;
        if(a-b==abc[0]&&b-c==abc[1]&&b+c==abc[3]){
            System.out.println(a+" "+b+" "+c);
        }else{
            System.out.println("No");
        }
    }

    public static void main(String[] args) {
        day2 iu=new day2();
        iu.find3("0 -1 3 5");
    }

}
